package com.yxy.mapper;

import com.github.pagehelper.Page;
import com.yxy.pojo.dto.HotelCollectPageQueryDTO;
import com.yxy.pojo.dto.SightsCollectPageQueryDTO;
import com.yxy.pojo.entity.HotelCollect;
import com.yxy.pojo.entity.SightsCollect;
import com.yxy.pojo.vo.HotelCollectPageQueryVO;
import com.yxy.pojo.vo.SightsCollectPageQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CollectMapper {
    /**
     * 根据用户id和景点id查询收藏记录
     * @param Integer
     * @param sightsId
     * @return
     */
    SightsCollect selectByUserIdAndSightsId(Integer userId, Integer sightsId);

    /**
     * 添加收藏记录
     * @param sightsCollect
     */
    void addSightsCollect(SightsCollect sightsCollect);

    /**
     * 修改收藏记录
     * @param sightsCollect
     */
    void updateSightsStatus(SightsCollect sightsCollect);

    /**
     * 根据用户id和酒店id查询收藏记录
     * @param currentId
     * @param id
     * @return
     */
    @Select("select * from hotel_collect where user_id = #{userId} and hotel_id = #{hotelId}")
    HotelCollect selectByUserIdAndHotelId(Integer userId, int hotelId);

    /**
     * 添加收藏记录
     * @param build
     */
    void addHotelCollect(HotelCollect build);

    /**
     * 修改收藏记录
     * @param hotelCollect
     */
    void updateHotelStatus(HotelCollect hotelCollect);

    /**
     * 分页查询景点收藏记录
     * @param sightsCollectPageQueryDTO
     * @return
     */
    @Select("select * from sights_collect where user_id = #{userId} and status = 1")
    Page<SightsCollectPageQueryVO> pageQuerySightsCollect(SightsCollectPageQueryDTO sightsCollectPageQueryDTO);

    /**
     * 分页查询酒店收藏记录
     * @param hotelCollectPageQueryDTO
     * @return
     */
    @Select("select * from hotel_collect where user_id = #{userId} and status = 1")
    Page<HotelCollectPageQueryVO> pageQueryHotelCollect(HotelCollectPageQueryDTO hotelCollectPageQueryDTO);
}
